package com.example.administrator.im.ui.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.example.administrator.im.R;
import com.example.administrator.im.adapter.SettingAdapter;
import com.example.administrator.im.interfacz.ShareTitleable;
import com.example.administrator.im.utils.DialogUtils;
import com.example.administrator.im.utils.EMUtils;
import com.example.administrator.im.view.ShareTitle;

import java.util.ArrayList;
import java.util.List;

/**
 * create:2018/10/2 16:15
 * author: 姚鸿杰
 **/
public class SettingActivity extends AppCompatActivity {


    private RecyclerView recyclerView;
    private SettingAdapter adapter;

    private ShareTitle shareTitle;

    public static final String SHOCK = "震动", SHOW_CONTENT = "通知栏显示消息内容", LED = "通知指示灯";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);

        initView();
    }

    public void initView(){
        shareTitle = (ShareTitle) findViewById(R.id.setting_toolbar);
        shareTitle.setIconOnClickListener(new ShareTitleable() {
            @Override
            public void left_click(View v) {
                finish();
            }

            @Override
            public void right_click(View v) {
            }
        });

        recyclerView = (RecyclerView) findViewById(R.id.rv_setting);
        List<RecyclerData> list = new ArrayList<>();
        list.add(new RecyclerData("消息", SHOCK));
        list.add(new RecyclerData("", SHOW_CONTENT));
        list.add(new RecyclerData("", LED));

        adapter = new SettingAdapter(list, this);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(adapter);
    }

    public void logout(View v) {
        DialogUtils.setDialog(this, R.layout.loading);
        DialogUtils.showDialog();
        EMUtils.logout(this);
    }

    public static class RecyclerData {
        private String title;
        private String content;

        public RecyclerData(String title, String content) {
            this.title = title;
            this.content = content;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }
    }

}
